package com.dzk.cp.c11x5.index.cs.by;

import java.util.List;

import com.dzk.cp.c11x5.index.rx.cs.RXnCSIndex;
import com.dzk.cp.c11x5.pojo.R5;

public abstract class CsByxRXnIndex extends CsByxIndex {
	
	protected CsByxRXnIndex setParams(int code, int num, int unit, String xc) {
		super.setParams(code, num, unit, xc);
		return this;
	}

	@Override
	protected Integer getCS(List<? extends R5> r5s, String xc) {
		return RXnCSIndex.getCS(r5s, xc);
	}
	
	public static CsByxRXnIndex getInstance(int code, int num, int unit, String xc) {
		int n = (xc.length() + 1) / 3;
		switch (n) {
		case 1:
			return new CsByxRX1Index().setParams(code, num, unit, xc);
		case 2:
			return new CsByxRX2Index().setParams(code, num, unit, xc);
		case 3:
			return new CsByxRX3Index().setParams(code, num, unit, xc);
		case 4:
			return new CsByxRX4Index().setParams(code, num, unit, xc);
		case 5:
			return new CsByxRX5Index().setParams(code, num, unit, xc);
		case 6:
			return new CsByxRX6Index().setParams(code, num, unit, xc);
		case 7:
			return new CsByxRX7Index().setParams(code, num, unit, xc);
		case 8:
			return new CsByxRX8Index().setParams(code, num, unit, xc);
		case 9:
			return new CsByxRX9Index().setParams(code, num, unit, xc);
		default:
			return null;
		}
	}

}

class CsByxRX1Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 11 / 5;
	}
	
}

class CsByxRX2Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 55 / 10;
	}
	
}

class CsByxRX3Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 165 / 10;
	}
	
}

class CsByxRX4Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 66;
	}
	
}

class CsByxRX5Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 462;
	}
	
}

class CsByxRX6Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 78;
	}
	
}

class CsByxRX7Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 26;
	}
	
}

class CsByxRX8Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 33 / 4;
	}
	
}

class CsByxRX9Index extends CsByxRXnIndex {

	@Override
	protected int getZQ() {
		return 11 / 3;
	}
	
}
